# 画冰雹猜想的曲线图
# Nasa 20211002
import pygame
import sys
from pygame_ok.pygame07 import make_points
from test58_bingbao import bingbao


def draw(n):
    l = []
    for i in range(1, n):
        a = len(bingbao(i))
        l.append(a)
    pygame.init()
    x = 1000
    y = 300
    screen = pygame.display.set_mode((x, y))
    fclock = pygame.time.Clock()
    while True:
        for e in pygame.event.get():
            if e.type == pygame.QUIT:
                pygame.quit()
                sys.exit()
        for j in range(1, len(l)):
            # print(f'x:{l*3},y:{list[l-1]}')
            pygame.draw.aaline(screen,
                               (255, 255, 255),
                               (j * 2, y - 0),
                               (j * 2, y - l[j - 1]))
        pygame.display.update()
        fclock.tick(30)


def draw2(dict):
    pygame.init()
    winx = 300
    winy = 500
    screen = pygame.display.set_mode((winx, winy))
    fclock = pygame.time.Clock()
    while True:
        for e in pygame.event.get():
            if e.type == pygame.QUIT:
                pygame.quit()
                sys.exit()
        for x, y in dict.items():
            # print(f'x:{l*3},y:{list[l-1]}')
            pygame.draw.aaline(screen,
                               (255, 255, 255),
                               (x * 5, (winy-y)),
                               (x * 5, winy))
        pygame.display.update()
        fclock.tick(30)


if __name__ == '__main__':
    list = bingbao(1000)
    # print(draw(500))
    # draw(list)
    dict = {5: 900, 2: 300, 6: 10}
    dict = make_points(2,200,1)
    draw2(dict)
